// src/router/index.ts
import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
// 定义路由配置
const routes: Array<RouteRecordRaw> = [
  // 根路径重定向
  {
    path: '/',
    redirect: '/console/dashboard'
  },
  
  // 控制台路由组
  {
    path: '/console',
    redirect: '/console/dashboard',
    component: () => import('@/views/ConsoleLayout.vue'),
    children: [
      {
        path: '/ai/model/apiKey',
        name: 'ApiKeyBasicSettings',
        component: () => import('@/views/ai/model/apiKey/index.vue')
      },
      {
        path: '/ai/model/model',
        name: 'ModelBasicSettings',
        component: () => import('@/views/ai/model/model/index.vue')
      },
      {
        path: '/ai/model/chatRole',
        name: 'ChatRoleBasicSettings',
        component: () => import('@/views/ai/model/chatRole/index.vue')
      },
    ]
  },
  
  // 其他页面路由
  {
    path: '/tools',
    name: 'Tools',
    component: () => import('@/views/tools.vue')
  },
  {
    path: '/ai/chat',
    name: 'AiChat',
    component: () => import('@/views/ChatAI.vue')
  },
  {
    path: '/my-groups',
    name: 'MyGroups',
    component: () => import('@/views/MyGroups.vue')
  },
  {
    path: '/my-interface',
    name: 'MyInterface',
    component: () => import('@/views/MyInterface.vue')
  },
  {
    path: '/api-management',
    name: 'ApiManagement',
    component: () => import('@/views/ApiManagement.vue')
  },
  {
    path: '/knowledge',
    name: 'Knowledge',
    component: () => import('@/views/Knowledge.vue')
  }
]

// 创建路由实例
const router = createRouter({
  history: createWebHistory(),
  routes
})

// 导出路由实例
export default router